package com.webserver.core;

import java.io.File;
import java.net.URISyntaxException;

public class DisnatcherServlet {
    private  static File staticDir;
    static {
     try {
         staticDir =new File(
                 ClientHandler.class
                         .getClassLoader().getResource(
                                 "./startc"
                         ).toURI());
     } catch (URISyntaxException e) {
         e.printStackTrace();
     }
    }
    File getFileUrl(String path) throws URISyntaxException {

        File fileUrl=new File(staticDir,path);
        boolean boolsur= fileUrl.exists();
        File finall =new File(staticDir,"/root/404.html");
        if (boolsur){
            return fileUrl;
        }else {

            return finall;
        }
    }
}
